/* 
 * @Author: 21克的爱情
 * @Date: 2020-09-27 16:28:21
 * @Email: raohong07@163.com
 * @LastEditors: 21克的爱情
 * @LastEditTime: 2020-09-27 17:13:14
 * @Description: 模拟ListTile
 */

import 'package:flutter/material.dart';

class ListTitleCustom extends StatelessWidget {
  final EdgeInsets contentPadding;
  final EdgeInsets titlePadding;
  final String title;
  final IconData icon;
  final Color color;
  final Function onTap;
  const ListTitleCustom(
    this.title, {
      Key key,
      this.contentPadding,
      this.titlePadding,
      this.onTap,
      this.color,
      this.icon
    }
  ) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () => onTap(),
      child: Container(
        padding: contentPadding is EdgeInsets ? contentPadding : EdgeInsets.all(0),
        child: Row(
          children: [
            icon is IconData ? Icon(
              icon,
              color: color is Color ? color : Colors.white
            ) : Container(),
            Expanded(
              child: Padding(
                padding: titlePadding is EdgeInsets ? titlePadding : EdgeInsets.all(0),
                child: Text(
                  title,
                  style: TextStyle(
                    color: color is Color ? color : Colors.white
                  ),
                )
              )
            )
          ],
        ),
      )
    );
  }
}